# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=gr-paint
pkgver=50.3806b20
pkgrel=3
pkgdesc='An OFDM Spectrum Painter for GNU Radio.'
arch=('x86_64' 'aarch64')
groups=('blackarch' 'blackarch-radio')
url='https://github.com/drmpeg/gr-paint'
license=('GPL3')
depends=('gnuradio' 'gnuradio-companion' 'python2-pillow6')
makedepends=('git' 'cmake' 'boost' 'pybind11' 'doxygen')
source=("git+https://github.com/drmpeg/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

prepare() {
  cd $pkgname

  mkdir -p build && cd build
  cmake -DCMAKE_INSTALL_PREFIX=/usr ..
}

build() {
  cd "$pkgname/build"

  make

  cd "$srcdir/$pkgname"

  gcc -o tgatoluma tgatoluma.c
}

package() {
  cd "$pkgname/build"

  make DESTDIR="$pkgdir" install

  install -Dm 755 "$srcdir/$pkgname/tgatoluma" "$pkgdir/usr/bin/tgatoluma"
}

